<html>
<script>
/**
* @param a Array
* @param b Array
*/
function remainder(a, b)
{
      var remainder = [];
     
      var c = a.concat(b);
      var index;
      var removes = [];
     
      for (var key in c)
      {
            index = remainder.indexOf(c[key]);
            if (index == -1)
            {
                  if (removes.indexOf(c[key]) == -1) remainder.push(c[key]);
            }
            else
            {
                  removes.push(c[key]);
                  remainder.splice(index, 1);
            }
      }
     
      console.log(remainder);
}
 
var a = ["a", "b", "c"];
var b = ["d", "b", "b", "b"];
 
remainder(a, b);
</script>
</html>